package com.thing.spring.ioc.dependency.lookup;

import com.thing.spring.ioc.dependency.domain.User;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.env.Environment;

public class LookUpDemo {
    public static void main(String[] args) {
        //配置xml配置文件
        //启动spring应用上下文
        BeanFactory applicationContext = new ClassPathXmlApplicationContext("META-INFO/dependency-lookup-context.xml");
        User user = applicationContext.getBean("user", User.class);
        System.out.println(user);

        Environment bean = applicationContext.getBean(Environment.class);
        System.out.println(bean);
    }
}
